<template>
	<view>
		<scroll-view class="item_box" scroll-y="true" @scrolltolower='scrolltolower' v-if="lists.length>0">
			<view class="sun_box" v-for="(item,i) in lists" style="padding: 0 15rpx;margin-top: 15rpx;">
				<view class="sun_text">
					<view class="" style="display: flex;align-items: center;">
						<view>
							<image :src="item.avatar" mode="aspectFill"
								style="width: 120rpx;height: 120rpx;border-radius: 50%;" v-if="item.avatar"></image>
							<image src="/static/logo.png" mode="aspectFill"
								style="width: 120rpx;height: 120rpx;border-radius: 50%;" v-else></image>
						</view>
						<view class="">
							<view style="margin-left: 20rpx;font-size: 35rpx;font-weight: 600;">{{item.name}}</view>
							<view class="sun_time" style="margin-left: 20rpx;margin-top: 10rpx;">{{item.phone}}</view>
						</view>
					</view>
				</view>
				<view class="" style="font-size: 28rpx;color: #999999;">
					<view class="sun_time" style="margin-left: 20rpx;margin-top: 10rpx;text-align: right;">
						邀请{{item.numberOfPeopleInTheGroup}}人</view>
					<view>{{item.addtime}}</view>
				</view>
			</view>
			<view class="" style="height: 160rpx;"></view>
		</scroll-view>

		<view class="" v-else
			style="width: 750rpx;height: 100vh;display: flex;align-items: center;justify-content: center;">
			<u-empty mode="list" icon="http://cdn.uviewui.com/uview/empty/list.png">
			</u-empty>
		</view>

		<view class="bottom_box">
			<view class="" style="display: flex;justify-content: space-between;width: 100%;">
				<view class="bottom_title">我的邀请人：</view>
				<view class="bottom_title">总邀请人数（{{peopleNum}}人） </view>
			</view>
			
			<view class="" v-if="yaoqin" style="display: flex;justify-content: space-between;">
				<view class="bottom_flx">
					<image :src="yaoqin.avatar" mode="aspectFill"
						style="width: 100rpx;height: 100rpx;border-radius: 50%;"></image>
					<view class="">
						<view style="margin-left: 20rpx;font-size: 35rpx;font-weight: 600;">{{yaoqin.name}}</view>
						<view class="sun_time" style="margin-left: 20rpx;margin-top: 10rpx;">{{yaoqin.phone}}</view>
					</view>
				</view>
				<view class="" style="margin-right: 30rpx;margin-top: 40rpx;">
					<u-icon name="phone-fill" color="#2979ff" size="38" @click="callPhone()"></u-icon>
				</view>
			</view>
			<view style="margin-left: 20rpx;font-size: 35rpx;font-weight: 600;" v-else>
				暂无邀请人
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				lists: [],
				yaoqin: null,
				peopleNum:0
			}
		},
		onShow() {
			this.list()
			this.cread()
		},
		methods: {
			// 拨打电话
			callPhone(tel) {
				uni.makePhoneCall({
					phoneNumber: this.yaoqin.phone
				})
			},
			async list() {
				let res = await this.$request("kehu/user/inviteUserList", {}, 'get')
				console.log(res)
				this.lists = res.data.data.list
				this.peopleNum =res.data.data.peopleNum
			},
			async cread() {
				let res = await this.$request("kehu/other/myReference")
				console.log(res)
				this.yaoqin = res.data
			}
		}
	}
</script>

<style scoped>
	.bottom_flx {
		margin-left: 20rpx;
		margin-top: 20rpx;
		display: flex;

	}

	.bottom_title {
		font-size: 28rpx;
		font-weight: 600;
		margin-left: 20rpx;
	}

	.bottom_box {
		width: 750rpx;
		background-color: #fff;
		padding-top: 20rpx;
		padding-bottom: 20rpx;
		position: fixed;
		bottom: 0%;
		background-color: #fff;
		box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
	}

	.Text1 {
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #fff;
		margin-right: 5rpx;
	}

	.rightIcon {
		width: 10rpx;
		height: 19rpx;
	}

	.btnBox {
		margin-left: auto;
		display: flex;
		align-items: center;
		position: absolute;
		right: 3%;
		top: 14%;
	}

	.tixian {
		color: #E87B83;
		font-size: 32rpx;
		text-align: right;
		padding-right: 30rpx;
		margin-top: 15rpx;
	}

	.sun_jifen {
		color: #0D62F1;
		font-size: 40rpx;
	}

	.sun_box {
		display: flex;
		justify-content: space-between;
		align-items: center;
		width: 100%;

		margin-bottom: 50rpx;
	}

	.index_title {
		padding-left: 30rpx;
		font-size: 34rpx;
		margin-top: 10rpx;
		font-weight: bold;
		position: relative;
		margin-bottom: 30rpx;
		margin-top: 20rpx;
	}

	.sun_title {
		width: 550rpx;
		font-size: 34rpx;
		font-weight: 600;
	}

	.sun_time {
		font-size: 28rpx;
		color: #999999;
		margin-top: 26rpx;
	}


	.index_dian {
		width: 140rpx;
		height: 13rpx;
		background-color: #fe471e;
		border-radius: 7rpx;
		position: absolute;
		bottom: 0rpx;
		opacity: 0.7;
	}

	page {
		background-color: #F5F5F5;
	}

	.item_box {
		background-color: #fff;
		height: 100vh;
		border-radius: 10rpx;
	}

	.top_box {
		height: 225rpx;
		background-color: #fe471e;
		border-radius: 10rpx;
		margin-left: 20rpx;
		margin-top: 40rpx;
		display: flex;
		justify-content: space-between;
	}

	.top_text {
		color: #fff;
		font-size: 32rpx;
		text-align: center;
		width: 200rpx;
		margin-left: 20rpx;
		padding-top: 50rpx;
	}

	.top_jifen {
		font-size: 60rpx;
		font-weight: 600;
		margin-top: 25rpx;
	}
</style>